﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace JCTimes.Portal.Infrastructure {
    public static class CacheHelper {
        private static int cacheTime = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CacheMinute"] + "");

        public static void Add(string key, object val) {
            System.Web.HttpContext.Current.Cache.Insert(key, val, null, DateTime.Now.AddMinutes(cacheTime), TimeSpan.Zero);
        }

        public static void Remove(string key) {
            System.Web.HttpContext.Current.Cache.Remove(key);
        }

        public static object Get(string key) {
            return System.Web.HttpContext.Current.Cache.Get(key);
        }
    }
}